package com.guoxin.concurrentcy.chapter6;

/**
 * @author guoxin
 * @date 2019/7/2
 */
@SuppressWarnings("all")
public class ThreadInterrupt {

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            try {
                while (true) {
                    Thread.sleep(10);
                }
            } catch (InterruptedException e) {
                System.out.println("收到打断信号");
                e.printStackTrace();
            }
        });
        t1.start();
        Thread.sleep(1_00);
        System.out.println(t1.isInterrupted());

        t1.interrupt();

        System.out.println(t1.isInterrupted());
    }
}
